<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	 
	 <meta name="description" content="XDMF parallel partitioned mesh I/O on top of HDF5">
    
    <meta name="author" content="Víctor Sande Veiga" >
    <link rel="icon" href="../favicon.png">

    <title>Count_tokens &ndash; XH5For</title>

    <link href="../css/bootstrap.min.css" rel="stylesheet">
    <link href="../css/pygments.css" rel="stylesheet">
    <link href="../css/font-awesome.min.css" rel="stylesheet">
    <link href="../css/local.css" rel="stylesheet">
    

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    
    <script src="../js/jquery-2.1.3.min.js"></script>
    <script src="../js/svg-pan-zoom.min.js"></script>

  </head>

  <body>

    <!-- Fixed navbar -->
    <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="../index.html">XH5For </a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
          <ul class="nav navbar-nav">
				
            <li class="dropdown hidden-xs visible-sm visible-md hidden-lg">
              <a href="#" class="dropdown-toggle"
              data-toggle="dropdown" role="button"
              aria-haspopup="true"
		 aria-expanded="false">Contents <span class="caret"></span></a>
	      <ul class="dropdown-menu">
              
            <li><a href="../lists/files.html">Source Files</a></li>
				
				
            <li><a href="../lists/modules.html">Modules</a></li>
				
            
                                
            <li><a href="../lists/procedures.html">Procedures</a></li>
				
								
            <li><a href="../lists/types.html">Derived Types</a></li>
				
				
            <li><a href="../lists/programs.html">Programs</a></li>
				
            </ul>
            </li>

<li class="visible-xs hidden-sm visible-lg"><a href="../lists/files.html">Source Files</a></li>


<li class="visible-xs hidden-sm visible-lg"><a href="../lists/modules.html">Modules</a></li>



<li class="visible-xs hidden-sm visible-lg"><a href="../lists/procedures.html">Procedures</a></li>

                             
<li class="visible-xs hidden-sm visible-lg"><a href="../lists/types.html">Derived Types</a></li>


<li class="visible-xs hidden-sm visible-lg"><a href="../lists/programs.html">Programs</a></li>

          </ul>
        
        <form action="../search.html" class="navbar-form navbar-right" role="search">
        <div class="form-group">
          <input type="text" class="form-control" placeholder="Search" name="q" id="tipue_search_input" autocomplete="off" required>
        </div>
<!--
        <button type="submit" class="btn btn-default">Submit</button>
-->
        </form>
        
        </div><!--/.nav-collapse -->
      </div>
    </nav>

    <div class="container">
    
  
  <div class="row">
    <h1>Count_tokens
      <small>Function</small>
    
    </h1>
    
<div class="row">
  <div class="col-lg-12">
<div class="well well-sm">
  <ul class="list-inline" style="margin-bottom:0px;display:inline">
     
     
     
     
    
    
     <li><i class="fa fa-list-ol"></i>
       <a data-toggle="tooltip"
	  data-placement="bottom" data-html="true"
	  title=" 2.9% of total for procedures.">20 statements</a>
     </li> 
     
     
    <li><i class="fa fa-code"></i><a href="../src/xdmf_utils.f90"> Source File</a></li>
     
  </ul>
  <ol class="breadcrumb in-well text-right">
  
     <li><a href='../sourcefile/xdmf_utils.f90.html'>xdmf_utils.f90</a></li>
  
     <li><a href='../module/xdmf_utils.html'>xdmf_utils</a></li>
  
     <li class="active">Count_tokens</li>
  </ol>
</div>
</div>
</div>
<script>
  $(function () {
  $('[data-toggle="tooltip"]').tooltip()
  })
</script>

  </div>
  
  <div class="row">
    <div class="col-md-3 hidden-xs hidden-sm visible-md visible-lg">
    
<div id="sidebar">
  




















<div class="panel panel-primary">
  <div class="panel-heading text-left"><h3 class="panel-title">Source Code</h3></div>
  <div class="list-group">
    <a class="list-group-item" href="../proc/count_tokens.html#src">Count_tokens</a>
  </div>
</div>


  <hr>
  

<div class="panel panel-default">
  <div class="panel-heading text-left"><h3 class="panel-title"><a data-toggle="collapse" href="#allprocs-0">All Procedures</a></h3></div>
  <div id="allprocs-0" class="panel-collapse collapse">
    <div class="list-group">
      
      <a class="list-group-item" href="../proc/abort.html">Abort</a>
      
      <a class="list-group-item" href="../proc/count_tokens.html">Count_tokens</a>
      
      <a class="list-group-item" href="../proc/generate_hexa_mesh.html">generate_hexa_mesh</a>
      
      <a class="list-group-item" href="../proc/generate_hexa_mesh%7E2.html">generate_hexa_mesh</a>
      
      <a class="list-group-item" href="../proc/getnumberofcomponentsfromattributetype.html">GetNumberOfComponentsFromAttributeType</a>
      
      <a class="list-group-item" href="../proc/getnumberofnodesperelement.html">GetNumberOfNodesPerElement</a>
      
      <a class="list-group-item" href="../proc/getspacedimension.html">GetSpaceDimension</a>
      
      <a class="list-group-item" href="../proc/getxdmfattributetypename.html">GetXDMFAttributeTypeName</a>
      
      <a class="list-group-item" href="../proc/getxdmfcentertypefromname.html">GetXDMFCenterTypeFromName</a>
      
      <a class="list-group-item" href="../proc/getxdmfcentertypename.html">GetXDMFCenterTypeName</a>
      
      <a class="list-group-item" href="../proc/getxdmfgeometrytypefromname.html">GetXDMFGeometryTypeFromName</a>
      
      <a class="list-group-item" href="../proc/getxdmfgeometrytypename.html">GetXDMFGeometryTypeName</a>
      
      <a class="list-group-item" href="../proc/getxdmftopologytypefromname.html">GetXDMFTopologyTypeFromName</a>
      
      <a class="list-group-item" href="../proc/getxdmftopologytypename.html">GetXDMFTopologyTypeName</a>
      
      <a class="list-group-item" href="../proc/is_in_option_list.html">is_in_option_list</a>
      
      <a class="list-group-item" href="../proc/issupportedattributecentername.html">isSupportedAttributeCenterName</a>
      
      <a class="list-group-item" href="../proc/issupportedattributetypename.html">isSupportedAttributeTypeNAme</a>
      
      <a class="list-group-item" href="../proc/issupporteddataitemformatname.html">isSupportedDataItemFormatName</a>
      
      <a class="list-group-item" href="../proc/issupporteddataitemnumbertypename.html">isSupportedDataItemNumberTypeName</a>
      
      <a class="list-group-item" href="../proc/issupporteddataitemprecision.html">isSupportedDataItemPrecision</a>
      
      <a class="list-group-item" href="../proc/issupporteddataitemtypename.html">isSupportedDataItemTypeName</a>
      
      <a class="list-group-item" href="../proc/issupportedgeometrytype.html">isSupportedGeometryType</a>
      
      <a class="list-group-item" href="../proc/issupportedgridcollectiontypename.html">isSupportedGridCollectionTypeName</a>
      
      <a class="list-group-item" href="../proc/issupportedgridsectionname.html">isSupportedGridSectionName</a>
      
      <a class="list-group-item" href="../proc/issupportedgridtype.html">isSupportedGridType</a>
      
      <a class="list-group-item" href="../proc/issupportedgridtypename.html">isSupportedGridTypeName</a>
      
      <a class="list-group-item" href="../proc/issupportedstrategy.html">isSupportedStrategy</a>
      
      <a class="list-group-item" href="../proc/issupportedtimetypename.html">isSupportedTimeTypeName</a>
      
      <a class="list-group-item" href="../proc/issupportedtopologytype.html">isSupportedTopologyType</a>
      
      <a class="list-group-item" href="../proc/issupportedtopologytypename.html">isSupportedTopologyTypeName</a>
      
      <a class="list-group-item" href="../proc/mkdirfullpath.html">MkdirFullPath</a>
      
      <a class="list-group-item" href="../proc/next_token.html">Next_token</a>
      
      <a class="list-group-item" href="../proc/upper_case.html">Upper_Case</a>
      
      <a class="list-group-item" href="../proc/warning_message.html">warning_message</a>
      
      <a class="list-group-item" href="../proc/wtime.html">Wtime</a>
      
    </div>
  </div>
</div>


</div>  

    </div>
    
    <div class="col-md-9" id='text'>
    <h2>
public function Count_tokens(s1, separator)
    
    
	 
</h2>
    
  


    
    <p>Function for counting tokens of a string 
 Modified to define a custom a separator. If present, separator
 is the only allowed separator character
 @author David Frank  dave_frank@hotmail.com (http://home.earthlink.net/~dave_gemini/strings.f90)</p>
    

    <h3>Arguments</h3>
    
      
<table class="table table-striped varlist">
<thead><tr><th>Type</th>
<th>Intent</th><th>Optional</th>
<th>Attributes</th><th></th><th>Name</th><th></th></thead>



<tbody>

  
  
  
  
<tr>
  
  <td><span class="anchor" id="variable-s1"></span>character(len=*),</td>
  <td>intent(in)</td>
  <td></td>
  
  <td></td><td>::</td>
  <td><strong>s1</strong></td><td></td>
  
</tr>

  
  
  
  
<tr>
  
  <td><span class="anchor" id="variable-separator"></span>character(len=1),</td>
  <td>intent(in),</td>
  <td>optional</td>
  
  <td></td><td>::</td>
  <td><strong>separator</strong></td><td></td>
  
</tr>

</tbody>
</table>

    
    
    
    
    
    
    
	 <h3>Return Value <small><span class="anchor" id="variable-count_tokens"></span>integer(kind=I4P)
  </small></h3>
    
    
    
     
    <br>

    <section class="visible-xs visible-sm hidden-md">
      




















<div class="panel panel-primary">
  <div class="panel-heading text-left"><h3 class="panel-title">Source Code</h3></div>
  <div class="list-group">
    <a class="list-group-item" href="../proc/count_tokens.html#src">Count_tokens</a>
  </div>
</div>


    </section>
    <br class="visible-xs visible-sm hidden-md">

    

    
    
    
    
    

    
    
    
    
    


    
    
    
    <section>
    <h2><span class="anchor" id="src"></span>Source Code</h2>
    <div class="highlight"><pre>    <span class="k">function </span><span class="n">Count_tokens</span><span class="p">(</span><span class="n">s1</span><span class="p">,</span> <span class="n">separator</span><span class="p">)</span>
    <span class="c">!-----------------------------------------------------------------</span>
    <span class="c">!&lt; Function for counting tokens of a string </span>
    <span class="c">!&lt; Modified to define a custom a separator. If present, separator</span>
    <span class="c">!&lt; is the only allowed separator character</span>
    <span class="c">!&lt; @author David Frank  dave_frank@hotmail.com (http://home.earthlink.net/~dave_gemini/strings.f90)</span>
    <span class="c">!-----------------------------------------------------------------</span>
        <span class="kt">character</span><span class="p">(</span><span class="nb">len</span><span class="o">=*</span><span class="p">),</span>           <span class="k">intent</span><span class="p">(</span><span class="n">IN</span><span class="p">)</span> <span class="kd">::</span> <span class="n">s1</span>
        <span class="kt">character</span><span class="p">(</span><span class="nb">len</span><span class="o">=</span><span class="mi">1</span><span class="p">),</span> <span class="k">optional</span><span class="p">,</span> <span class="k">intent</span><span class="p">(</span><span class="n">IN</span><span class="p">)</span> <span class="kd">::</span> <span class="n">separator</span>
        <span class="kt">character</span><span class="p">(</span><span class="nb">len</span><span class="o">=</span><span class="nb">len</span><span class="p">(</span><span class="n">s1</span><span class="p">))</span>                 <span class="kd">::</span> <span class="n">s</span>
        <span class="kt">integer</span><span class="p">(</span><span class="n">I4P</span><span class="p">)</span>                           <span class="kd">::</span> <span class="n">Count_tokens</span>
        <span class="kt">integer</span><span class="p">(</span><span class="n">I4P</span><span class="p">)</span>                           <span class="kd">::</span> <span class="n">i</span><span class="p">,</span> <span class="n">k</span>
    <span class="c">!-----------------------------------------------------------------</span>
        <span class="n">s</span> <span class="o">=</span> <span class="n">s1</span>                            <span class="c">! remove possible last char null (in C)</span>
        <span class="n">k</span> <span class="o">=</span> <span class="mi">0_I4P</span>  <span class="p">;</span> <span class="k">if</span> <span class="p">(</span><span class="n">s</span> <span class="o">/=</span> <span class="s1">&#39; &#39;</span><span class="p">)</span> <span class="n">k</span> <span class="o">=</span> <span class="mi">1_I4P</span>      <span class="c">! string has at least 1 item</span>
        <span class="k">if</span><span class="p">(</span><span class="nb">present</span><span class="p">(</span><span class="n">separator</span><span class="p">)</span> <span class="p">)</span> <span class="k">then</span>
<span class="k">            do </span><span class="n">i</span> <span class="o">=</span> <span class="mi">1_I4P</span><span class="p">,</span><span class="nb">len_trim</span><span class="p">(</span><span class="n">s</span><span class="p">,</span> <span class="nb">kind</span><span class="o">=</span><span class="n">I4P</span><span class="p">)</span><span class="o">-</span><span class="mi">1_I4P</span>
               <span class="k">if</span><span class="p">(</span><span class="n">s</span><span class="p">(</span><span class="n">i</span><span class="p">:</span><span class="n">i</span><span class="p">)</span> <span class="o">/=</span> <span class="n">separator</span> <span class="p">.</span><span class="nb">and</span><span class="p">.</span><span class="n">s</span><span class="p">(</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">:</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span> <span class="o">==</span> <span class="n">separator</span><span class="p">)</span> <span class="n">k</span> <span class="o">=</span> <span class="n">k</span><span class="o">+</span><span class="mi">1</span>
            <span class="n">enddo</span>
        <span class="k">else</span>
<span class="k">            do </span><span class="n">i</span> <span class="o">=</span> <span class="mi">1_I4P</span><span class="p">,</span><span class="nb">len_trim</span><span class="p">(</span><span class="n">s</span><span class="p">,</span> <span class="nb">kind</span><span class="o">=</span><span class="n">I4P</span><span class="p">)</span><span class="o">-</span><span class="mi">1_I4P</span>
               <span class="k">if</span><span class="p">(</span><span class="n">s</span><span class="p">(</span><span class="n">i</span><span class="p">:</span><span class="n">i</span><span class="p">)</span> <span class="o">/=</span> <span class="s1">&#39; &#39;</span><span class="p">.</span><span class="nb">and</span><span class="p">.</span><span class="n">s</span><span class="p">(</span><span class="n">i</span><span class="p">:</span><span class="n">i</span><span class="p">)</span> <span class="o">/=</span> <span class="s1">&#39;,&#39;</span><span class="p">.</span><span class="nb">and</span><span class="p">.</span><span class="n">s</span><span class="p">(</span><span class="n">i</span><span class="o">+</span><span class="mi">1_I4P</span><span class="p">:</span><span class="n">i</span><span class="o">+</span><span class="mi">1_I4P</span><span class="p">)</span> <span class="o">==</span> <span class="s1">&#39; &#39;</span><span class="p">.</span><span class="nb">or</span><span class="p">.</span><span class="n">s</span><span class="p">(</span><span class="n">i</span><span class="o">+</span><span class="mi">1_I4P</span><span class="p">:</span><span class="n">i</span><span class="o">+</span><span class="mi">1_I4P</span><span class="p">)</span> <span class="o">==</span> <span class="s1">&#39;,&#39;</span><span class="p">)</span> <span class="n">k</span> <span class="o">=</span> <span class="n">k</span><span class="o">+</span><span class="mi">1_I4P</span>
            <span class="n">enddo</span>
        <span class="n">endif</span>
        <span class="n">Count_tokens</span> <span class="o">=</span> <span class="n">k</span>
    <span class="k">end function </span><span class="n">Count_tokens</span>
</pre></div>

    </section>
    <br>
    
    
    </div>
  </div>

  <section class="visible-xs visible-sm hidden-md">
    <hr>
    

<div class="panel panel-default">
  <div class="panel-heading text-left"><h3 class="panel-title"><a data-toggle="collapse" href="#allprocs-1">All Procedures</a></h3></div>
  <div id="allprocs-1" class="panel-collapse collapse">
    <div class="list-group">
      
      <a class="list-group-item" href="../proc/abort.html">Abort</a>
      
      <a class="list-group-item" href="../proc/count_tokens.html">Count_tokens</a>
      
      <a class="list-group-item" href="../proc/generate_hexa_mesh.html">generate_hexa_mesh</a>
      
      <a class="list-group-item" href="../proc/generate_hexa_mesh%7E2.html">generate_hexa_mesh</a>
      
      <a class="list-group-item" href="../proc/getnumberofcomponentsfromattributetype.html">GetNumberOfComponentsFromAttributeType</a>
      
      <a class="list-group-item" href="../proc/getnumberofnodesperelement.html">GetNumberOfNodesPerElement</a>
      
      <a class="list-group-item" href="../proc/getspacedimension.html">GetSpaceDimension</a>
      
      <a class="list-group-item" href="../proc/getxdmfattributetypename.html">GetXDMFAttributeTypeName</a>
      
      <a class="list-group-item" href="../proc/getxdmfcentertypefromname.html">GetXDMFCenterTypeFromName</a>
      
      <a class="list-group-item" href="../proc/getxdmfcentertypename.html">GetXDMFCenterTypeName</a>
      
      <a class="list-group-item" href="../proc/getxdmfgeometrytypefromname.html">GetXDMFGeometryTypeFromName</a>
      
      <a class="list-group-item" href="../proc/getxdmfgeometrytypename.html">GetXDMFGeometryTypeName</a>
      
      <a class="list-group-item" href="../proc/getxdmftopologytypefromname.html">GetXDMFTopologyTypeFromName</a>
      
      <a class="list-group-item" href="../proc/getxdmftopologytypename.html">GetXDMFTopologyTypeName</a>
      
      <a class="list-group-item" href="../proc/is_in_option_list.html">is_in_option_list</a>
      
      <a class="list-group-item" href="../proc/issupportedattributecentername.html">isSupportedAttributeCenterName</a>
      
      <a class="list-group-item" href="../proc/issupportedattributetypename.html">isSupportedAttributeTypeNAme</a>
      
      <a class="list-group-item" href="../proc/issupporteddataitemformatname.html">isSupportedDataItemFormatName</a>
      
      <a class="list-group-item" href="../proc/issupporteddataitemnumbertypename.html">isSupportedDataItemNumberTypeName</a>
      
      <a class="list-group-item" href="../proc/issupporteddataitemprecision.html">isSupportedDataItemPrecision</a>
      
      <a class="list-group-item" href="../proc/issupporteddataitemtypename.html">isSupportedDataItemTypeName</a>
      
      <a class="list-group-item" href="../proc/issupportedgeometrytype.html">isSupportedGeometryType</a>
      
      <a class="list-group-item" href="../proc/issupportedgridcollectiontypename.html">isSupportedGridCollectionTypeName</a>
      
      <a class="list-group-item" href="../proc/issupportedgridsectionname.html">isSupportedGridSectionName</a>
      
      <a class="list-group-item" href="../proc/issupportedgridtype.html">isSupportedGridType</a>
      
      <a class="list-group-item" href="../proc/issupportedgridtypename.html">isSupportedGridTypeName</a>
      
      <a class="list-group-item" href="../proc/issupportedstrategy.html">isSupportedStrategy</a>
      
      <a class="list-group-item" href="../proc/issupportedtimetypename.html">isSupportedTimeTypeName</a>
      
      <a class="list-group-item" href="../proc/issupportedtopologytype.html">isSupportedTopologyType</a>
      
      <a class="list-group-item" href="../proc/issupportedtopologytypename.html">isSupportedTopologyTypeName</a>
      
      <a class="list-group-item" href="../proc/mkdirfullpath.html">MkdirFullPath</a>
      
      <a class="list-group-item" href="../proc/next_token.html">Next_token</a>
      
      <a class="list-group-item" href="../proc/upper_case.html">Upper_Case</a>
      
      <a class="list-group-item" href="../proc/warning_message.html">warning_message</a>
      
      <a class="list-group-item" href="../proc/wtime.html">Wtime</a>
      
    </div>
  </div>
</div>


  </section>

    <hr>    
    </div> <!-- /container -->
    <footer>
      <div class="container">
      <div class="row">
        <div class="col-xs-6 col-md-4"><p>&copy; 2016 </p></div>
        <div class="col-xs-6 col-md-4 col-md-push-4">
          <p class="text-right">
            Documentation generated by 
            <a href="https://github.com/cmacmackin/ford">FORD</a>
             on 2016-11-08T12:24:53.235950 
          </p>
        </div>
        <div class="col-xs-12 col-md-4 col-md-pull-4"><p class="text-center"> XH5For was developed by Víctor Sande Veiga</p></div>
      </div>
      <br>
      </div> <!-- /container -->    
    </footer>

    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
<!--
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
-->
    <script src="../js/bootstrap.min.js"></script>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="../js/ie10-viewport-bug-workaround.js"></script>

    <!-- MathJax JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        TeX: { extensions: ['AMSmath.js','AMSsymbols.js','noErrors.js','noUndefined.js'], equationNumbers: { autoNumber: 'AMS' } },
        jax: ['input/TeX','input/MathML','output/HTML-CSS'],
        extensions: ['tex2jax.js','mml2jax.js','MathMenu.js','MathZoom.js'],
        'HTML-CSS': { 
           styles: { '.MathJax_Display, .MathJax .mo, .MathJax .mi, .MathJax .mn': {color: '#000000 ! important'} }
        }
      });
    </script>
    <script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
    
    
    <script src="../tipuesearch/tipuesearch_content.js"></script>
    <link  href="../tipuesearch/tipuesearch.css" rel="stylesheet">
    <script src="../tipuesearch/tipuesearch_set.js"></script>
    <script src="../tipuesearch/tipuesearch.js"></script>
    
    
  </body>
</html>